#!/usr/bin/env bash

SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
pushd "${SCRIPT_DIR}/.build/"

make elf/subdir_lib $@

read -p "ln -s into /usr/local/rewine/lib ? [Y] " yn
case $yn in
    [Yy]* )
        sudo mkdir -p /usr/local/rewine/rt/lib
        sudo ln -sf "$PWD/elf/ld.so" /usr/local/rewine/rt/lib/ld-2.30.so
        sudo ln -sf /usr/local/rewine/rt/lib/ld-linux-x86-64.so.2 ld-2.30.so
        ;;
    *) ;;
esac

popd
